package com.xiaowenxiong.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by 15c on 2017/3/24.
 */
@Controller
public class HelloController {

    @RequestMapping(value = {"/hello","/"},method = RequestMethod.GET)
    public String hello( String name,Model model){
        System.out.print(name);
        model.addAttribute("name",name);
        //model传单值
        return "hello";

    }
    @ResponseBody
    @RequestMapping(value = "/test")
    public String test(@RequestParam("username") String username){

        return username+"test";
    }
    //model传值 方法增加参数
    @ResponseBody
    @RequestMapping(value = "/model")
    public String model(){
       return "model";
    }


}
